WaitForExistsTimed

Waits a period of time for a window or control to exist before continuing with the next statement and returns the number of milliseconds it took to find it.

This statement is often used with conditional statements to handle known exceptions. For example, you can use it to determine if a window, control, or page is displayed within a period of time before performing actions. See Handling known exceptions.

Syntax

WaitForExistsTimed(WaitTime)

Arguments

Argument Description
WaitTime Maximum number of milliseconds to search for the window or control.

Return value

Value Description
Value Number of milliseconds to find the window or control.
-1 Window or control was not found.

Supported objects

Browser, Button, Calendar, Cell, CheckBox, ColumnHeader, ComboBox, Control, DateTimePicker, EditBox, Grid, HTMLElement, HTMLLink, HTMLTable, Image, Item, Label, Link, ListBox, ListView, Menu, NavigationField, PopupMenu, ProgressBar, RadioButton, Row, RowHeader, ScrollBar, Slider, SpinBox, SubItem, Tab, TabBar, ToolBar, Tree, Window

Example

findTime = Window("WysiCorp CRM").Menu("MenuBar").WaitForExistsTimed(5000)

If findTime < 0 Then

PrintLn("Menu not found in five seconds")

Window("WysiCorp CRM").Close()

Else

Window("WysiCorp CRM").Menu("MenuBar").Item("File/Exit").Select()

End If